<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>vue3-escook</title>
  <link rel="stylesheet" href="./lib/style.css">
  <script type="importmap">
    {
      "imports" : {
        "vue": "./lib/vue-3.4.29.js"
      }
    }
  </script>
  <script type="module">
    import { createApp, ref, watch } from 'vue'

    const app = createApp({
      setup() {
        const title = ref('彬哥')

        watch(title, (newTitle) => {
          console.log('1')
          document.title = newTitle
        }, {
          // immediate: true 可以让侦听器在页面首次渲染完成后，立即触发1次
          immediate: true,
          once: true
        })

        return {
          title
        }
      }
    })

    app.mount('#app')
  </script>
</head>

<body>
  <div id="app">
    <input type="text" v-model="title">
  </div>
</body>

</html>